<script setup lang="ts">
import { AnswerItem, Question } from "../../index.d.ts";
import { ref } from "vue";

const props = defineProps<{ pd: Question; index: number }>();
const emit = defineEmits(["hasAnswer"]);

const answerItem = ref<AnswerItem>({
  questionID: props.pd.id,
  content: "",
  type: props.pd.type,
});
</script>

<template>
  <div class="question-title">
    {{ index + 1 }}.{{ pd.title }}
    <!-- <span class="text-red-600">(本题的难度为{{ pd.difficulty }})</span> -->
  </div>
  <el-radio-group
    class="question-content"
    v-model="answerItem.content"
    @change="() => emit('hasAnswer', answerItem)"
  >
    <el-radio :label="1">对</el-radio>
    <el-radio :label="0">错</el-radio>
  </el-radio-group>
</template>

<style scoped></style>
